From b2e678e81dd9635eb33279e2817168d13b78c1fa Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Thu, 8 Dec 2016 17:17:04 -0800 Subject: [PATCH] fix out of bound access to mode_strings mode == ARRAY_SIZE(mode_strings) causes an out of bound access to the mode_strings array. Coverity-ID: 1381859 Signed-off-by: Stefano Stabellini Reviewed-by: Julien Grall --- xen/arch/arm/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 7ab96d4cb5..90aba2a6d6 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -656,7 +656,7 @@ static const char *mode_string(uint32_t cpsr) }; mode = cpsr & PSR_MODE_MASK; - if ( mode > ARRAY_SIZE(mode_strings) ) + if ( mode >= ARRAY_SIZE(mode_strings) ) return "Unknown"; return mode_strings[mode] ? : "Unknown"; } -- 2.30.2